const api = require('../api/vdata')

const getData = async req => {
	let apiArr = []
	for (const key in api) {
		apiArr.push({
			name: key,
			fn: api[key],
		})
	}
	let apiRes = await Promise.allSettled(apiArr.map(item => item.fn(req)))

	let data = {}
	apiRes.map((res, index) => {
		data[apiArr[index].name] = res.value.data
	})
	return {
		code: 0,
		data,
	}
}

module.exports = getData
